const room = "default_room";

module.exports = (app) => {
  let obj = {};
  return async (ctx, next) => {
    ctx.socket.on("online", (data) => {
      obj = data;
    });
    ctx.socket.join(room);
    ctx.socket.to(room).emit("res", obj);
    await next();
  };
};
